<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" enctype="multipart/form-data" method="post">
					<div class="tips am-margin-bottom-sm am-u-sm-12">
					    <div class="pre">
					        <p>模板消息类目设置为“IT科技/互联网|电子商务”和“餐饮/餐饮”，<a href="https://mp.weixin.qq.com/" target="_blank">去设置获取模板ID</a></p>
					    </div>
					</div>
					<div class="widget-body">
                        <fieldset>
							<div class="widget-head am-cf">
								<div class="widget-title am-fl">支付成功通知</div>
							</div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">
									模版ID <span class="tpl-form-line-small-title">Template ID</span>
								</label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="tpl-form-input" name="setting[payment][template_id]"
                                           value="<?= $values['payment']['template_id']?>">
                                    <small>模板编号：OPENTM400231951</small>
                                </div>
                            </div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									转向到网址 <span class="tpl-form-line-small-title">URL</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[payment][url]"
							               value="<?= $values['payment']['url']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									转向到小程序 <span class="tpl-form-line-small-title">APPID</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[payment][miniprogram][appid]"
							               value="<?= $values['payment']['miniprogram']['appid']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									小程序链接 <span class="tpl-form-line-small-title">URL</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[payment][miniprogram][pagepath]"
							               value="<?= $values['payment']['miniprogram']['pagepath']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">通知标题 </label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[payment][data][first][value]"
							               value="<?= $values['payment']['data']['first']['value']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">备注 </label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[payment][data][remark][value]"
							               value="<?= $values['payment']['data']['remark']['value']?>">
							    </div>
							</div>
							<div class="widget-head am-cf">
								<div class="widget-title am-fl">充值成功提醒</div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									模版ID <span class="tpl-form-line-small-title">Template ID</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[recharge][template_id]"
							               value="<?= $values['recharge']['template_id']?>">
							        <small>模板编号：OPENTM412075804</small>
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									转向到网址 <span class="tpl-form-line-small-title">URL</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[recharge][url]"
							               value="<?= $values['recharge']['url']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									转向到小程序 <span class="tpl-form-line-small-title">APPID</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[recharge][miniprogram][appid]"
							               value="<?= $values['recharge']['miniprogram']['appid']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									小程序链接 <span class="tpl-form-line-small-title">URL</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[recharge][miniprogram][pagepath]"
							               value="<?= $values['recharge']['miniprogram']['pagepath']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">通知标题 </label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[recharge][data][first][value]"
							               value="<?= $values['recharge']['data']['first']['value']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">备注 </label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[recharge][data][remark][value]"
							               value="<?= $values['recharge']['data']['remark']['value']?>">
							    </div>
							</div>
							<div class="widget-head am-cf">
								<div class="widget-title am-fl">订单发货提醒</div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									模版ID <span class="tpl-form-line-small-title">Template ID</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[delivery][template_id]"
							               value="<?= $values['delivery']['template_id']?>">
							        <small>模板编号：OPENTM416664558</small>
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									转向到网址 <span class="tpl-form-line-small-title">URL</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[delivery][url]"
							               value="<?= $values['delivery']['url']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									转向到小程序 <span class="tpl-form-line-small-title">APPID</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[delivery][miniprogram][appid]"
							               value="<?= $values['delivery']['miniprogram']['appid']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									小程序链接 <span class="tpl-form-line-small-title">URL</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[delivery][miniprogram][pagepath]"
							               value="<?= $values['delivery']['miniprogram']['pagepath']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">通知标题 </label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[delivery][data][first][value]"
							               value="<?= $values['delivery']['data']['first']['value']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">备注 </label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[delivery][data][remark][value]"
							               value="<?= $values['delivery']['data']['remark']['value']?>">
							    </div>
							</div>
							<div class="widget-head am-cf">
								<div class="widget-title am-fl">售后服务处理进度提醒</div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									模版ID <span class="tpl-form-line-small-title">Template ID</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[refund][template_id]"
							               value="<?= $values['refund']['template_id']?>">
							        <small>模板编号：TM00254</small>
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									转向到网址 <span class="tpl-form-line-small-title">URL</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[refund][url]"
							               value="<?= $values['refund']['url']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									转向到小程序 <span class="tpl-form-line-small-title">APPID</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[refund][miniprogram][appid]"
							               value="<?= $values['refund']['miniprogram']['appid']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">
									小程序链接 <span class="tpl-form-line-small-title">URL</span>
								</label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[refund][miniprogram][pagepath]"
							               value="<?= $values['refund']['miniprogram']['pagepath']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">通知标题 </label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[refund][data][first][value]"
							               value="<?= $values['refund']['data']['first']['value']?>">
							    </div>
							</div>
							<div class="am-form-group">
							    <label class="am-u-sm-3 am-form-label form-require">备注 </label>
							    <div class="am-u-sm-9">
							        <input type="text" class="tpl-form-input" name="setting[refund][data][remark][value]"
							               value="<?= $values['refund']['data']['remark']['value']?>">
							    </div>
							</div>
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {

        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm();

        /**
         * 发送测试短信
         */
        $('.j-sendTestMsg').click(function () {
            var msgType = $(this).data('msg-type')
                , formData = {
                AccessKeyId: $('input[name="sms[engine][aliyun][AccessKeyId]"]').val()
                , AccessKeySecret: $('input[name="sms[engine][aliyun][AccessKeySecret]"]').val()
                , sign: $('input[name="sms[engine][aliyun][sign]"]').val()
                , msg_type: msgType
                , template_code: $('input[name="sms[engine][aliyun][' + msgType + '][template_code]"]').val()
                , accept_phone: $('input[name="sms[engine][aliyun][' + msgType + '][accept_phone]"]').val()
            };
            if (!formData.AccessKeyId.length) {
                layer.msg('请填写 AccessKeyId');
                return false;
            }
            if (!formData.AccessKeySecret.length) {
                layer.msg('请填写 AccessKeySecret');
                return false;
            }
            if (!formData.sign.length) {
                layer.msg('请填写 短信签名');
                return false;
            }
            if (!formData.template_code.length) {
                layer.msg('请填写 模板ID');
                return false;
            }
            if (!formData.accept_phone.length) {
                layer.msg('请填写 接收手机号');
                return false;
            }
            layer.confirm('确定要发送测试短信吗', function (index) {
                var load = layer.load();
                var url = "<?= url('setting/smsTest') ?>";
                $.post(url, formData, function (result) {
                    layer.msg(result.msg);
                    layer.close(load);
                });
                layer.close(index);
            });
        });

    });
</script>
